/**
 * 2011-01-11
 */
package com.yuanheng100.ems4j.common.security;

import java.security.MessageDigest;

/**
 * MD加密组件
 *
 * @author ShenHuaJie
 * @version 1.0
 * @since 1.0
 */
public abstract class MDCoder extends SecurityCoder
{

    /**
     * MD5加密
     *
     * @param data 待加密数据
     * @return byte[] 消息摘要
     * @throws Exception
     */
    public static byte[] encodeMD5(byte[] data) throws Exception
    {
        // 初始化MessageDigest
        MessageDigest md = MessageDigest.getInstance("MD5");
        // 执行消息摘要
        return md.digest(data);
    }
}
